home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Development / AmigaTalk_X / intuition / GadgetAttrs.st < prev    next >
Encoding:
Text File  |  2002-03-13  |  16.0 KB  |  390 lines

  1. " --------------------------------------------------------------------- "
  2. " GadgetAttrs Class is a Singleton class that allows the user to        "
  3. " reference Gadget Attributes without having to remember their actual   "
  4. " hexadecimal values.                                                   "
  5. ""
  6. " The User does NOT need to create one of these, since Intuition Class  "
  7. " will instantiate the only needed instance of this Class.  See the     "
  8. " SetupIntuition.st source file for the method(s) that help the User    "
  9. " with this Class.                                                      "
  10. ""
  11. " ALL singleton classes MUST contain the following:                     "
  12. ""
  13. "   the methods:  isSingleton AND privateSetup     AND                  "
  14. "                 uniqueInstance Class instance variable.               "
  15. " --------------------------------------------------------------------- "
  16.  
  17. Class GadgetAttributes :Dictionary ! uniqueInstance !
  18. [
  19.    isSingleton
  20.      ^ true  
  21. |  
  22.    privateNew ! newinstance !
  23.     newinstance <- super new.
  24.  
  25.     ^ newinstance
  26. |
  27.    new
  28.      ^ (self privateSetup)
  29. |
  30.    privateInitializeDictionary    "Too big for a block."
  31.  
  32.       self at: #GA_Left           put: 16r80030001.
  33.       self at: #GA_RelRight       put: 16r80030002.
  34.       self at: #GA_Top            put: 16r80030003.
  35.       self at: #GA_RelBottom      put: 16r80030004.
  36.       self at: #GA_Width          put: 16r80030005.
  37.       self at: #GA_RelWidth       put: 16r80030006.
  38.       self at: #GA_Height         put: 16r80030007.
  39.       self at: #GA_RelHeight      put: 16r80030008.
  40.       self at: #GA_Text           put: 16r80030009.
  41.       self at: #GA_Image          put: 16r8003000A.
  42.       self at: #GA_Border         put: 16r8003000B.
  43.       self at: #GA_SelectRender   put: 16r8003000C.
  44.       self at: #GA_Highlight      put: 16r8003000D.
  45.       self at: #GA_Disabled       put: 16r8003000E.
  46.       self at: #GA_GZZGadget      put: 16r8003000F.
  47.       self at: #GA_ID             put: 16r80030010.
  48.       self at: #GA_UserData       put: 16r80030011.
  49.       self at: #GA_SpecialInfo    put: 16r80030012.
  50.       self at: #GA_Selected       put: 16r80030013.
  51.       self at: #GA_EndGadget      put: 16r80030014.
  52.       self at: #GA_Immediate      put: 16r80030015.
  53.       self at: #GA_RelVerify      put: 16r80030016.
  54.       self at: #GA_FollowMouse    put: 16r80030017.
  55.       self at: #GA_RightBorder    put: 16r80030018.
  56.       self at: #GA_LeftBorder     put: 16r80030019.
  57.       self at: #GA_TopBorder      put: 16r8003001A.
  58.       self at: #GA_BottomBorder   put: 16r8003001B.
  59.       self at: #GA_ToggleSelect   put: 16r8003001C.
  60.       self at: #GA_SysGadget      put: 16r8003001D.
  61.       self at: #GA_SysGType       put: 16r8003001E.
  62.       self at: #GA_Previous       put: 16r8003001F.
  63.       self at: #GA_Next           put: 16r80030020.
  64.       self at: #GA_DrawInfo       put: 16r80030021.
  65.       self at: #GA_IntuiText      put: 16r80030022.
  66.       self at: #GA_LabelImage     put: 16r80030023.
  67.       self at: #GA_TabCycle       put: 16r80030024.
  68.       self at: #GA_GadgetHelp     put: 16r80030025.
  69.       self at: #GA_Bounds         put: 16r80030026.
  70.       self at: #GA_RelSpecial     put: 16r80030027.
  71.       self at: #GA_TextAttr       put: 16r80030028.
  72.       self at: #GA_ReadOnly       put: 16r80030029.
  73.       self at: #GA_Underscore     put: 16r8003002A.
  74.       self at: #GA_ActivateKey    put: 16r8003002B.
  75.       self at: #GA_BackFill       put: 16r8003002C.
  76.       self at: #GA_GadgetHelpText put: 16r8003002D.
  77.       self at: #GA_UserInput      put: 16r8003002E.
  78.  
  79.       self at: #LAYOUTA_LayoutObj      put: 16r80038001.
  80.       self at: #LAYOUTA_Spacing        put: 16r80038002.
  81.       self at: #LAYOUTA_Orientation    put: 16r80038003.
  82.       self at: #LAYOUTA_ChildMaxWidth  put: 16r80038004.
  83.       self at: #LAYOUTA_ChildMaxHeight put: 16r80038005.
  84.  
  85.       " String Gadget Attributes: "
  86.  
  87.       self at: #STRINGA_MaxChars       put: 16r80032001.
  88.       self at: #STRINGA_Buffer         put: 16r80032002.
  89.       self at: #STRINGA_UndoBuffer     put: 16r80032003.
  90.       self at: #STRINGA_WorkBuffer     put: 16r80032004.
  91.       self at: #STRINGA_BufferPos      put: 16r80032005.
  92.       self at: #STRINGA_DispPos        put: 16r80032006.
  93.       self at: #STRINGA_AltKeyMap      put: 16r80032007.
  94.       self at: #STRINGA_Font           put: 16r80032008.
  95.       self at: #STRINGA_Pens           put: 16r80032009.
  96.       self at: #STRINGA_ActivePens     put: 16r8003200A.
  97.       self at: #STRINGA_EditHook       put: 16r8003200B.
  98.       self at: #STRINGA_EditModes      put: 16r8003200C.
  99.       self at: #STRINGA_ReplaceMode    put: 16r8003200D.
  100.       self at: #STRINGA_FixedFieldMode put: 16r8003200E.
  101.       self at: #STRINGA_NoFilterMode   put: 16r8003200F.
  102.       self at: #STRINGA_Justification  put: 16r80032010.
  103.       self at: #STRINGA_LongVal        put: 16r80032011.
  104.       self at: #STRINGA_TextVal        put: 16r80032012.
  105.       self at: #STRINGA_ExitHelp       put: 16r80032013.
  106.  
  107.       self at: #LAYOUTA_LayoutObj      put: 16r80038001.
  108.       self at: #LAYOUTA_Spacing        put: 16r80038002.
  109.       self at: #LAYOUTA_Orientation    put: 16r80038003.
  110.       self at: #LAYOUTA_ChildMaxWidth  put: 16r80038004.
  111.       self at: #LAYOUTA_ChildMaxHeight put: 16r80038005.
  112.  
  113.       " Proportional Gadget Attributes: "
  114.  
  115.       self at: #PGA_Freedom       put: 16r80031001.
  116.       self at: #PGA_Borderless    put: 16r80031002.
  117.       self at: #PGA_HorizPot      put: 16r80031003.
  118.       self at: #PGA_HorizBody     put: 16r80031004.
  119.       self at: #PGA_VertPot       put: 16r80031005.
  120.       self at: #PGA_VertBody      put: 16r80031006.
  121.       self at: #PGA_Total         put: 16r80031007.
  122.       self at: #PGA_Visible       put: 16r80031008.
  123.       self at: #PGA_Top           put: 16r80031009.
  124.       self at: #PGA_NewLook       put: 16r8003100A.
  125. |
  126.    privateSetup
  127.      (uniqueInstance isNil)
  128.        ifTrue: [uniqueInstance <- self privateNew.
  129.                 self privateInitializeDictionary   
  130.                ].
  131.  
  132.      ^ self
  133. ]
  134.  
  135. " -------------------------------------------------------------------- "
  136. " GadToolsAttributes Class is a singleton class for the attribute tags "
  137. " associated with GadTools Gadgets & GadTools Menus.                   "
  138. ""
  139. " NOTE:  The keys are in Gadget Order, not numerical order in here.    "
  140. ""
  141. " The User does NOT need to create one of these, since Intuition Class "
  142. " will instantiate the only needed instance of this Class.  See the    "
  143. " SetupIntuition.st source file for the method(s) that help the User   "
  144. " with this Class.                                                     "
  145. ""
  146. " ALL singleton classes MUST contain the following:                    "
  147. ""
  148. "   the methods:  isSingleton AND privateSetup     AND                 "
  149. "                 uniqueInstance Class instance variable.              "
  150. " -------------------------------------------------------------------- "
  151.  
  152. Class GadToolsAttributes :Dictionary ! uniqueInstance !
  153. [
  154.    isSingleton
  155.      ^ true  
  156. |  
  157.    privateNew ! newinstance !
  158.     newinstance <- super new.
  159.  
  160.     ^ newinstance
  161. |
  162.    new
  163.      ^ (self privateSetup)
  164. |
  165.    privateInitializeDictionary        "Too big for a Block."
  166.  
  167.      "GadTools attributes (1-3, 25-37 reserved):"
  168.  
  169.      "NewMenu Attributes:"
  170.      self at: #GTMN_TextAttr          put: 16r80080031.
  171.      self at: #GTMN_FrontPen          put: 16r80080032.
  172.                 
  173.      "GTMN_Menu is used internally only!"
  174.      self at: #GTMN_Menu              put: 16r8008003C.
  175.  
  176.      " Asks CreateMenus() to validate that this is a complete menu structure: "
  177.      self at: #GTMN_FullMenu          put: 16r8008003E.
  178.  
  179.      " ti_Data is a pointer to ULONG to receive error reports from CreateMenus()"
  180.      self at: #GTMN_SecondaryError put: 16r8008003F. 
  181.      self at: #GTMN_Checkmark      put: 16r80080041. " ti_Data is checkmark img to use " 
  182.      self at: #GTMN_AmigaKey       put: 16r80080042. " ti_Data is Amiga-key img to use " 
  183.      self at: #GTMN_NewLookMenus   put: 16r80080043. " ti_Data is boolean "
  184.  
  185.      " NewMenus tags & flags: "                
  186.  
  187.      self at: #NM_TITLE         put: 1.
  188.      self at: #NM_ITEM          put: 2.
  189.      self at: #NM_SUB           put: 3.
  190.      self at: #NM_END           put: 0.
  191.      self at: #NM_IGNORE        put: 64.
  192.      self at: #NM_BARLABEL      put: -1.
  193.      self at: #IM_ITEM          put: 130.   " Graphical menu item "
  194.      self at: #IM_SUB           put: 131.   " Graphical menu sub-item "
  195.      self at: #NM_MENUDISABLED  put: 1.     " Same as MENU_ENABLED "
  196.      self at: #NM_ITEMDISABLED  put: 16.    " Same as ITEMENABLED "
  197.      self at: #NM_COMMANDSTRING put: 4.     " Same as COMMSEQ "
  198.      self at: #NM_FLAGMASK      put: 16r39. "(~(COMMSEQ | ITEMTEXT | HIGHFLAGS))"
  199.      self at: #NM_FLAGMASK_V39  put: 16r3D. "(~(ITEMTEXT | HIGHFLAGS))"
  200.  
  201.      " These return codes can be obtained through the GTMN_SecondaryError tag "
  202.  
  203.      " Too many menus, items, or subitems, menu has been trimmed down: "
  204.      self at: #GTMENU_TRIMMED   put: 1. 
  205.      self at: #GTMENU_INVALID   put: 2. " Invalid NewMenu array "
  206.      self at: #GTMENU_NOMEM     put: 3. " Out of memory "
  207.                 
  208.  
  209.      "General Gadget Attributes:" 
  210.      self at: #GT_VisualInfo          put: 16r80080034.
  211.      self at: #GT_Reserved1           put: 16r80080038.
  212.      self at: #GT_Underscore          put: 16r80080040.
  213.  
  214.      "String (R/W) Gadget Attributes:"
  215.      self at: #GTST_String            put: 16r8008002D.
  216.      self at: #GTST_MaxChars          put: 16r8008002E.
  217.      self at: #GTST_EditHook          put: 16r80080037.
  218.  
  219.      "Integer (R/W) Gadget Attributes:"
  220.      self at: #GTIN_Number            put: 16r8008002F.
  221.      self at: #GTIN_MaxChars          put: 16r80080030.
  222.      self at: #GTIN_EditHook          put: 16r80080037.
  223.  
  224.      "Text (read-only) Gadget Attributes:"
  225.      self at: #GTTX_Text              put: 16r8008000B.
  226.      self at: #GTTX_CopyText          put: 16r8008000C.
  227.      self at: #GTTX_Border            put: 16r80080039.
  228.      self at: #GTTX_FrontPen          put: 16r80080048.
  229.      self at: #GTTX_BackPen           put: 16r80080049.
  230.      self at: #GTTX_Justification     put: 16r8008004A.
  231.      self at: #GTTX_Clipped           put: 16r80080055.
  232.  
  233.      "Number (read-only) Gadget Attributes:"
  234.      self at: #GTNM_Number            put: 16r8008000D.
  235.      self at: #GTNM_Border            put: 16r8008003A.
  236.      self at: #GTNM_FrontPen          put: 16r80080048.
  237.      self at: #GTNM_BackPen           put: 16r80080049.
  238.      self at: #GTNM_Justification     put: 16r8008004A.
  239.      self at: #GTNM_Format            put: 16r8008004B.
  240.      self at: #GTNM_MaxNumberLen      put: 16r8008004C.
  241.      self at: #GTNM_Clipped           put: 16r80080055.
  242.  
  243.      "ListView Gadget Attributes:"
  244.      self at: #GTLV_Top               put: 16r80080005.
  245.      self at: #GTLV_Labels            put: 16r80080006.
  246.      self at: #GTLV_ReadOnly          put: 16r80080007.
  247.      self at: #GTLV_ScrollWidth       put: 16r80080008.
  248.      self at: #GTLV_ShowSelected      put: 16r80080035.
  249.      self at: #GTLV_Selected          put: 16r80080036.
  250.      self at: #GTLV_MakeVisible       put: 16r8008004E.
  251.      self at: #GTLV_ItemHeight        put: 16r8008004F.
  252.      self at: #GTLV_CallBack          put: 16r80080053.
  253.      self at: #GTLV_MaxPen            put: 16r80080054.
  254.  
  255.      "CheckBox Gadget Attributes:"
  256.      self at: #GTCB_Checked           put: 16r80080004.
  257.      self at: #GTCB_Scaled            put: 16r80080044.
  258.  
  259.      "Radio Button (Mutual Excluded) Gadget Attributes:"
  260.      self at: #GTMX_Labels            put: 16r80080009.
  261.      self at: #GTMX_Active            put: 16r8008000A.
  262.      self at: #GTMX_Spacing           put: 16r8008003D.
  263.      self at: #GTMX_Scaled            put: 16r80080045.
  264.      self at: #GTMX_TitlePlace        put: 16r80080047.
  265.  
  266.      "Cycle Gadget Attributes:"
  267.      self at: #GTCY_Labels            put: 16r8008000E.
  268.      self at: #GTCY_Active            put: 16r8008000F.
  269.  
  270.      "Palette Gadget Attributes:"
  271.      self at: #GTPA_Depth             put: 16r80080010.
  272.      self at: #GTPA_Color             put: 16r80080011.
  273.      self at: #GTPA_ColorOffset       put: 16r80080012.
  274.      self at: #GTPA_IndicatorWidth    put: 16r80080013.
  275.      self at: #GTPA_IndicatorHeight   put: 16r80080014.
  276.      self at: #GTPA_NumColors         put: 16r80080046.
  277.      self at: #GTPA_ColorTable        put: 16r80080052.
  278.  
  279.      "Slider (proportional) Gadget Attributes:"
  280.      self at: #GTSL_Min               put: 16r80080026.
  281.      self at: #GTSL_Max               put: 16r80080027.
  282.      self at: #GTSL_Level             put: 16r80080028.
  283.      self at: #GTSL_MaxLevelLen       put: 16r80080029.
  284.      self at: #GTSL_LevelFormat       put: 16r8008002A.
  285.      self at: #GTSL_LevelPlace        put: 16r8008002B.
  286.      self at: #GTSL_DispFunc          put: 16r8008002C.
  287.      self at: #GTSL_MaxPixelLen       put: 16r80080050.
  288.      self at: #GTSL_Justification     put: 16r80080051.
  289.  
  290.      "Scroller Gadget Attributes:"
  291.      self at: #GTSC_Top               put: 16r80080015.
  292.      self at: #GTSC_Total             put: 16r80080016.
  293.      self at: #GTSC_Visible           put: 16r80080017.
  294.      self at: #GTSC_Overlap           put: 16r80080018.
  295.      self at: #GTSC_Arrows            put: 16r8008003B.
  296.  
  297.      "BevelBox Attribute(s):"
  298.      self at: #GTBB_Recessed          put: 16r80080033.
  299.      self at: #GTBB_FrameType         put: 16r8008004D.
  300. |
  301.    privateSetup
  302.      (uniqueInstance isNil)
  303.        ifTrue: [uniqueInstance <- self privateNew.
  304.                 self privateInitializeDictionary
  305.                ].
  306.  
  307.      ^ self "uniqueInstance??"
  308. ]
  309.  
  310. " --------------------------------------------------------------------- "
  311. " GadgetMethodIDs Class is a Singleton class that allows the user to    "
  312. " reference Gadget Method IDs without having to remember their actual   "
  313. " hexadecimal values.                                                   "
  314. ""
  315. " The User does NOT need to create one of these, since Intuition Class  "
  316. " will instantiate the only needed instance of this Class.  See the     "
  317. " SetupIntuition.st source file for the method(s) that help the User    "
  318. " with this Class.                                                      "
  319. ""
  320. " ALL singleton classes MUST contain the following:                     "
  321. ""
  322. "   the methods:  isSingleton AND privateSetup     AND                  "
  323. "                 uniqueInstance Class instance variable.               "
  324. " --------------------------------------------------------------------- "
  325.  
  326. Class GadgetMethodIDs :Dictionary ! uniqueInstance !
  327. [
  328.    isSingleton
  329.      ^ true  
  330. |  
  331.    privateNew ! newinstance !
  332.     newinstance <- super new.
  333.  
  334.     ^ newinstance
  335. |
  336.    new
  337.      ^ (self privateSetup)
  338. |
  339.    privateInitializeDictionary    "Too big for a block."
  340.  
  341.       self at: #GM_Dummy          put: 16rFFFFFFFF.
  342.       self at: #GM_HITTEST        put: 16r0.
  343.       self at: #GM_RENDER         put: 16r1.
  344.       self at: #GM_GOACTIVE       put: 16r2.
  345.       self at: #GM_HANDLEINPUT    put: 16r3.
  346.       self at: #GM_GOINACTIVE     put: 16r4.
  347.       self at: #GM_HELPTEST       put: 16r5.
  348.       self at: #GM_LAYOUT         put: 16r6.
  349.       self at: #GM_DOMAIN         put: 16r7.
  350.       self at: #GM_KEYTEST        put: 16r8.
  351.       self at: #GM_KEYGOACTIVE    put: 16r9.
  352.       self at: #GM_KEYGOINACTIVE  put: 16rA.
  353.       
  354.       "For GM_HITTEST:" 
  355.       self at: #GMR_GADGETHIT     put: 16r4.
  356.       self at: #GMR_HOHELPHIT     put: 0.
  357.       self at: #GMR_HELPHIT       put: 16rFFFFFFFF.
  358.       self at: #GMR_HELPCODE      put: 16r00010000.
  359.  
  360.       "For GM_RENDER:"
  361.       self at: #GREDRAW_UPDATE    put: 16r2.
  362.       self at: #GREDRAW_REDRAW    put: 1.
  363.       self at: #GREDRAW_TOGGLE    put: 0.
  364.  
  365.       "For GM_HANDLEINPUT & GM_GOACTIVE:"
  366.       self at: #GMR_MEACTIVE      put: 0.
  367.       self at: #GMR_NOREUSE       put: 2.
  368.       self at: #GMR_REUSE         put: 4.
  369.       self at: #GMR_VERIFY        put: 8.
  370.       self at: #GMR_NEXTACTIVE    put: 16r10.
  371.       self at: #GMR_PREVACTIVE    put: 16r20.
  372.  
  373.       "For GM_DOMAIN:"
  374.       self at: #GDOMAIN_MINIMUM   put: 0.
  375.       self at: #GDOMAIN_NOMINAL   put: 1.
  376.       self at: #GDOMAIN_MAXIMUM   put: 2.
  377.       
  378.       "For GM_KEYGOACTIVE:"
  379.       self at: #GMR_KEYACTIVE     put: 16r10.
  380.       self at: #GMR_KEYVERIFY     put: 16r20.
  381. |
  382.    privateSetup
  383.      (uniqueInstance isNil)
  384.        ifTrue: [uniqueInstance <- self privateNew.
  385.                 self privateInitializeDictionary   
  386.                ].
  387.  
  388.      ^ self
  389. ]
  390.